﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SalePartial.Model;
using SalePartial.IDAL;
using System.Data.SqlClient;
using System.Data;

namespace SalePartial.BLL
{
    public class XPInquiryEvent : IXPInquiryEvent
    {
        private IXPInquiryEvent dal = SalePartial.DALFactory.DataAccess.CreateXPInquiryEvent();


        public XPInquiryEventInfo GetXPInquiryEvent(Guid id)
        {
            SqlDataReader reader = this.SelectReader(id);
            XPInquiryEventInfo info = null;
            if (reader.Read())
            {
                info = new XPInquiryEventInfo(reader);
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
            }
            return info;
        }

        public int Delete(Guid EventID)
        {
            return dal.Delete(EventID);
        }

        public int DeleteByBuyerCompanyID(Guid BuyerCompanyID)
        {
            return dal.DeleteByBuyerCompanyID(BuyerCompanyID);
        }

        public int DeleteByInquiryID(Guid InquiryID)
        {
            return dal.DeleteByInquiryID(InquiryID);
        }

        public int DeleteByVendorCompanyID(Guid VendorCompanyID)
        {
            return dal.DeleteByVendorCompanyID(VendorCompanyID);
        }

        public int DeleteDynamic(string v_whereCondition)
        {
            return dal.DeleteDynamic(v_whereCondition);
        }

        public int Insert(XPInquiryEventInfo info)
        {
            return dal.Insert(info);
        }

        public DataSet SelectAll()
        {
            return dal.SelectAll();
        }

        public DataSet SelectByBuyerCompanyID(Guid BuyerCompanyID)
        {
            return dal.SelectByBuyerCompanyID(BuyerCompanyID);
        }

        public DataSet SelectByInquiryID(Guid InquiryID)
        {
            return dal.SelectByInquiryID(InquiryID);
        }

        public DataSet SelectByVendorCompanyID(Guid VendorCompanyID)
        {
            return dal.SelectByVendorCompanyID(VendorCompanyID);
        }

        public DataSet SelectDynamic(string v_whereCondition, string v_orderByExpression)
        {
            return dal.SelectDynamic(v_whereCondition, v_orderByExpression);
        }

        public DataSet SelectPaged()
        {
            return dal.SelectPaged();
        }

        public SqlDataReader SelectReader(Guid EventID)
        {
            return dal.SelectReader(EventID);
        }

        public SqlDataReader SelectReaderByBuyerCompanyID(Guid BuyerCompanyID)
        {
            return dal.SelectReaderByBuyerCompanyID(BuyerCompanyID);
        }

        public SqlDataReader SelectReaderByInquiryID(Guid InquiryID)
        {
            return dal.SelectReaderByInquiryID(InquiryID);
        }

        public SqlDataReader SelectReaderByVendorCompanyID(Guid VendorCompanyID)
        {
            return dal.SelectReaderByVendorCompanyID(VendorCompanyID);
        }

        public DataSet SelectSingle(Guid EventID)
        {
            return dal.SelectSingle(EventID);
        }

        public int Update(XPInquiryEventInfo info)
        {
            return dal.Update(info);
        }

    }
}
